<template>
  <header>
    <div class="navbar-container">
      <ul class="navbar-list">
        <li class="navbar-item">
          <router-link to="/home/searchInfo">首页</router-link>
        </li>

        <li class="navbar-item">
          <a href="javascript:void(0);">新闻动态</a>
        </li>
        <li class="navbar-item" @click="showResourceMarket()">
          <a href="javascript:void(0);" >资源市场</a>
        </li>
      </ul>
      <div class="navbar-search">
        <input type="text" class="search" placeholder="查询" v-model="searchContent" >
        <button class="button-primary" @click="callMethod()">查询</button>
      </div>
      <div class="navbar-sign" @click="showSelfInfo()">
          <span>{{userName}}</span>
      </div>
    </div>
  </header>
</template>

<script>
  export default {
    name: "headerComponent",
    data() {
      return {
        userName:this.$store.getters.getUserName,
        searchContent:""
      }
    },
    methods: {
      callMethod:function () {
        this.$parent.searchWorkInfo(this.searchContent);
      },
      showResourceMarket:function () {//显示资源市场信息
        this.$parent.showResourceMarket();
      },
      showSelfInfo:function () {//显示个人信息
        this.$parent.showSelfInfo();
      }
    }
  }
</script>

<style scoped>
  header{
    position:sticky;
    width: 100%;
    top: 0px;
    box-shadow: 0px 0px 3px #453857;
    z-index: 10;
  }
  .navbar-container {
    background-color: white;
    padding: 0 20px;
    color: #1a1a1a;
  }

  .navbar-left {
    display: inline-block;
    text-align: center;
    margin: 20px 0px;
    margin-left: 25px;
  }

  .navbar-list {
    display: inline-block;
    list-style-type: none;
    text-align: center;
    margin: 20px 0px;
    padding: 0px;
    margin-left: 326px;
    color: #1a1a1a;
  }

  .navbar-list .navbar-item {
    display: inline-block;
    margin: 0 20px;
  }

  .navbar-search .search {
    padding: 6px 12px;
    font-size: 14px;
    color: #555;
    background-color: #fff;
    background-image: none;
    border: 1px solid #ccc;
    border-radius: 4px;
  }

  .navbar-search {
    display: inline-block;
    margin-left: 45px;
    font-weight: 600;
  }

  .navbar-search .button-primary {
    background-color: #fff;
    border: 1px solid #eee;
    padding: 4px 7px;
    border-radius: 4px;
    cursor: pointer;
  }

  .navbar-search .search-btn:hover {
    cursor: pointer;
  }

  .navbar-sign {
    display: inline-block;
    margin-left: 21%;
    font-size: 18px;
    font-weight: 600;
    cursor: pointer;
  }
  .navbar-sign button {
    background-color: #fff;
    padding: 0px;
    border: 1px solid #eee;
    padding: 4px 7px;
    border-radius: 4px;
    top: 2px;
  }

  .navbar-list .navbar-item a {
    display: inline-block;
    padding: 0px 5px 8px 5px;
    text-decoration: none;
    font-size: 14px;
    font-weight: 600;
  }

  .button-primary{
    background-color: #fff;
    padding: 0px;
    border: 1px solid #eee;
    padding: 4px 7px;
    border-radius: 4px;
  }
</style>
